package com.zr.lads.service.impl;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.zr.lads.dao.LineDao;
import com.zr.lads.pojo.Line;
import com.zr.lads.service.LineService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
@Repository(value="lineService")
public class LineServiceImpl implements LineService{
    @Resource
    private LineDao<Line> linedao;
	@Override
	public JSONObject findlines(  int page, int rows) {
		// TODO Auto-generated method stub
		JSONObject lines=new JSONObject();
		int lcount=linedao.findlinecountsbylineid( );
		
		lines.put("total", lcount);
		List<Line> ls=linedao.findlinesbylineid( page, rows);
		
		JsonConfig jcf=new JsonConfig();
		jcf.setExcludes(new String[]{"schedules"});
		
	lines.put("rows", JSONArray.fromObject(ls, jcf));
		
		
		return lines;
	}
	@Override
	public boolean addlines(Line l) {
		// TODO Auto-generated method stub
		
		return linedao.addlines(l);
	}
	@Override
	public boolean updatelines(int lineId, String lineName, String beginPoint, String endPoint) {
		// TODO Auto-generated method stub
		
		return linedao.updatelines(lineId, lineName, beginPoint, endPoint);
	}
	@Override
	public boolean deletelines(String lineIds) {
		// TODO Auto-generated method stub
		return linedao.deletelines(lineIds);
	}

}
